Title: SQL W3S (By-BKK) / 121 Keywords
Tags: Obsidian_to_Anki

Q: What does the SQL keyword ADD do?
A: Adds a column in an existing table

Q: Adds a column in an existing table
A: What does the SQL keyword ADD do?

Q: What is the function of ADD CONSTRAINT in SQL?
A: Adds a constraint after a table is already created

Q: Adds a constraint after a table is created
A: What is the function of ADD CONSTRAINT in SQL?

Q: True/False: ALL returns true if all subquery values meet the condition
A: True

Q: Which SQL keyword adds, deletes, or modifies columns in a table?
A: ALTER

Q: ALTER keyword in SQL can change the data type of a column. True/False
A: True

Q: What does ALTER COLUMN do in SQL?
A: Changes the data type of a column in a table

Q: ALTER TABLE keyword can add, delete, or modify columns in a table. True/False
A: True

Q: What does the keyword AND do in SQL?
A: Includes only rows where both conditions are true

Q: Includes only rows where both conditions are true in SQL
A: What does the keyword AND do?

Q: What does ANY return in a subquery?
A: Returns true if any subquery value meets the condition

Q: What does AS do in SQL?
A: Renames a column or table with an alias

Q: Renames a column or table with an alias
A: What does AS do in SQL?

Q: What does ASC do in SQL queries?
A: Sorts results in ascending order

Q: Sorts results in ascending order in SQL
A: What does ASC do in SQL queries?

Q: BACKUP DATABASE is used to do what in SQL?
A: Creates a backup of an existing database

Q: Creates a backup of a database
A: What does BACKUP DATABASE do in SQL?

Q: What is the role of BETWEEN in SQL?
A: Selects values within a given range

Q: Selects values within a range in SQL
A: What is the role of BETWEEN?

Q: CASE creates different outputs based on what?
A: Conditions

Q: True/False: CHECK can limit the values placed in a column
A: True

Q: What does COLUMN do in SQL?
A: Changes the data type or deletes a column in a table

Q: What is a CONSTRAINT in SQL?
A: Condition that can be added or deleted to a column or table

Q: True/False: CREATE can be used for databases, tables, views, indexes, procedures
A: True

Q: Which keyword is used to create a new SQL database?
A: CREATE DATABASE

Q: True/False: CREATE INDEX allows duplicate values
A: True

Q: CREATE UNIQUE INDEX in SQL ensures what?
A: No duplicate values in the index

Q: What does CREATE VIEW do in SQL?
A: Creates a view based on the result set of a SELECT statement

Q: Which SQL keyword creates or deletes databases?
A: DATABASE

Q: What is the DEFAULT constraint?
A: Provides a default value for a column

Q: Which SQL keyword deletes rows from a table?
A: DELETE

Q: DESC sorts results in which order?
A: Descending order

Q: True/False: DISTINCT selects only different values
A: True

Q: DROP keyword is used to do what in SQL?
A: Deletes a column, constraint, database, index, table, or view

Q: DROP COLUMN removes what from a table?
A: A column

Q: DROP CONSTRAINT deletes which types of constraints?
A: UNIQUE, PRIMARY KEY, FOREIGN KEY, or CHECK

Q: DROP DATABASE removes what?
A: An existing SQL database

Q: True/False: DROP DEFAULT deletes a DEFAULT constraint
A: True

Q: DROP INDEX deletes what in SQL?
A: An index in a table

Q: DROP TABLE deletes what from a database?
A: An existing table

Q: DROP VIEW deletes what?
A: A view

Q: EXEC keyword does what in SQL?
A: Executes a stored procedure

Q: EXISTS checks for what in a subquery?
A: Existence of any record

Q: FOREIGN KEY is used to link what?
A: Two tables together

Q: FROM keyword specifies what?
A: Which table to select or delete data from

Q: FULL OUTER JOIN returns what rows?
A: All rows if there is a match in either left or right table

Q: GROUP BY is used with which functions?
A: Aggregate functions: COUNT, MAX, MIN, SUM, AVG

Q: HAVING is used in place of what with aggregate functions?
A: WHERE

Q: IN keyword allows you to do what in WHERE clauses?
A: Specify multiple values

Q: INDEX creates or deletes what in a table?
A: An index

Q: INNER JOIN returns rows that have what?
A: Matching values in both tables

Q: What does INSERT INTO do in SQL?
A: Inserts new rows in a table

Q: INSERT INTO SELECT copies data from what to what?
A: One table to another table

Q: IS NULL tests for what values?
A: Empty values

Q: IS NOT NULL tests for what values?
A: Non-empty values

Q: JOIN combines data from what?
A: Multiple tables

Q: LEFT JOIN returns all rows from which table?
A: Left table and matching rows from right table

Q: LIKE is used to search for what in a column?
A: A specified pattern

Q: LIMIT specifies what in SQL?
A: Number of records to return

Q: NOT keyword includes rows where condition is not what?
A: Not true

Q: NOT NULL constraint does what in SQL?
A: Enforces column to not accept NULL values

Q: OR includes rows if either condition is what?
A: True

Q: ORDER BY sorts result set in what orders?
A: Ascending or descending order

Q: OUTER JOIN returns all rows if there is a match in what?
A: Either left table or right table

Q: PRIMARY KEY uniquely identifies what?
A: Each record in a database table

Q: PROCEDURE is what in SQL?
A: A stored procedure

Q: RIGHT JOIN returns all rows from which table?
A: Right table and matching rows from left table

Q: ROWNUM specifies what in the result set?
A: Number of records to return

Q: SELECT is used to do what in a database?
A: Select data

Q: SELECT DISTINCT does what?
A: Selects only distinct values

Q: SELECT INTO copies data from one table into what?
A: A new table

Q: SELECT TOP specifies what?
A: Number of records to return in result set

Q: SET specifies what in an UPDATE statement?
A: Columns and values to be updated

Q: TABLE can create, add, delete, modify columns, or delete a table or data. True/False
A: True

Q: TOP specifies what in SQL SELECT queries?
A: Limit records returned

Q: TRUNCATE TABLE deletes what?
A: Data inside a table, not the table itself

Q: UNION combines result sets from how many SELECT statements?
A: Two or more (distinct values only)

Q: UNION ALL allows what in combined results?
A: Duplicate values

Q: UNIQUE constraint ensures what?
A: All values in a column are unique

Q: UPDATE does what in SQL tables?
A: Updates existing rows

Q: VALUES specifies what in an INSERT INTO statement?
A: Values to insert

Q: VIEW can be used to do what in SQL?
A: Create, update, or delete a view

Q: WHERE keyword filters results based on what?
A: Specified condition